/**
 * 
 */
package com.suyx.job.controller;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.suyx.job.config.BaiduOCR;
import com.suyx.job.entity.Result;
import com.suyx.job.utils.DeviceCodeMapUtil;
import com.suyx.job.utils.ImagePHash;
import com.suyx.job.utils.ImageUtils;
import com.suyx.job.utils.ScreenCapture;
import com.suyx.job.utils.SpeechUtil;

import lombok.extern.slf4j.Slf4j;

/**
 * @author syx
 */
@Slf4j
@RestController
@RequestMapping("/mhxySmTask")
public class MhxySmTaskController {
	private static String SC_PIC_PATH = "H:\\android\\MH\\";//梦幻宝图截图放置路径
	@Autowired
    private BaiduOCR baiduOCR;
	
	@PostMapping(value="smTask")
    public Result smTask(String deviceCode) throws Exception{	
    	for(int i =0;i<40 ;i++){
    		if(doSmTask(deviceCode)){
    			SpeechUtil.textToSpeech(DeviceCodeMapUtil.deviceCode_map.get(deviceCode)+"号机器师门任务完成");
    			break;
    		};
    	}
    	return new Result(true,"师门任务完成!");
    }
	
	private static String[] SAVE_TASK_DOODS_ARRAYS = {"粮","包子","山药","鬼切草","佛手","百色花","九香虫","七叶莲","草果","月见草","香叶"};
	private final static Map<String,String> wp_arrays = new HashMap<>();
	private final static Map<String,String> ca_1 = new HashMap<>();
	private final static Map<String,String> ca_2 = new HashMap<>();
	private final static Map<String,String> ca_3 = new HashMap<>();
	private final static Map<String,String> ca_4 = new HashMap<>();
	static {  
		wp_arrays.put("折扇", "0&980&135"); 
		wp_arrays.put("红缨枪", "0&1070&135");  
		wp_arrays.put("钝铁重剑", "0&1160&135");
		wp_arrays.put("牛皮鞭", "0&1250&135");
		wp_arrays.put("曲柳杖", "0&1350&135");
		wp_arrays.put("铁爪", "0&980&219");
		wp_arrays.put("松木锤", "0&1075&223");
		wp_arrays.put("琉璃珠", "0&1155&223");
		wp_arrays.put("双短剑", "0&1253&223");
		wp_arrays.put("青铜短剑", "0&1352&223");
		wp_arrays.put("柳叶刀", "0&980&310");
		wp_arrays.put("素纸灯", "0&1073&310");
		wp_arrays.put("青铜斧", "0&1167&310");
		//由于orc会吧青铜斧识别为青铜芹
		wp_arrays.put("青铜芹", "0&1167&310");
		wp_arrays.put("五色缎带", "0&1256&310");
		wp_arrays.put("黄铜圈", "0&1340&310");
		wp_arrays.put("硬木弓", "0&980&402");
		wp_arrays.put("细木棒", "0&1073&402");
		wp_arrays.put("油纸伞", "0&1167&402");
		
		wp_arrays.put("腰带", "1&1160&135");
		wp_arrays.put("护身符", "1&1250&135");
		
		wp_arrays.put("布衣", "2&980&135"); 
		wp_arrays.put("方巾", "2&1070&135"); 
		wp_arrays.put("布裙", "2&1075&223");
		wp_arrays.put("布鞋", "2&1155&223");
		wp_arrays.put("簪子", "2&1253&223");
		
		wp_arrays.put("桃花", "3&1070&135");  
		wp_arrays.put("兰花", "3&1250&135");
		
		wp_arrays.put("香", "4&980&135"); 
		wp_arrays.put("蜡烛", "4&1070&135");  
		wp_arrays.put("黄纸", "4&1160&135");	
	} 
    
	static {  
		ca_1.put("李世民", "13&423&223&0");
		ca_1.put("左统领", "4&423&223&0");
		ca_1.put("右统领", "4&423&223&0");
		ca_1.put("魏征",   "9&423&223&0");
		ca_1.put("房玄龄", "9&423&223&0");
		ca_1.put("杜如晦", "8&423&223&0");
		ca_1.put("赵美人", "2&266&360&0");
		ca_1.put("王捕头", "2&329&510&0");
		ca_1.put("秦夫人", "5&404&472&1");
		ca_1.put("秦琼",   "9&404&472&0");
		ca_1.put("刘副将", "2&524&461&0");
		ca_1.put("陈员外", "2&524&461&0");
		ca_1.put("殷夫人", "10&530&375&0");
		ca_1.put("殷丞相", "8&530&375&0");
	}
	
	static {  
		ca_2.put("吴举人", "10&728&268");
		ca_2.put("怜儿姑娘","2&720&434");
		ca_2.put("袁守诚", "2&549&584");
		ca_2.put("张老财", "2&673&561");
		ca_2.put("赌霸天", "9&744&505");
		ca_2.put("穷汉", "6&744&505");
		ca_2.put("王武", "4&899&400");
		ca_2.put("兰虎", "2&986&418");
		ca_2.put("冯铁匠", "14&986&418");
	}
	
	static {  
		ca_3.put("程夫人", "29&768&146&0&732&21");
		ca_3.put("慧悲","13&1108&153&0&856&55");
		ca_3.put("慧海", "10&1108&153&0&856&55");
		ca_3.put("慧静", "20&1108&153&0&856&55");
		ca_3.put("慧明", "13&1108&153&0&856&55");
		ca_3.put("疥癞和尚", "5&1108&153&0&856&55");
		ca_3.put("空善大师", "9&1108&153&0&856&55");
		ca_3.put("法明长老", "14&1108&153&0&856&55");
		ca_3.put("空度禅师", "23&1108&153&0&856&55");
		ca_3.put("空慈方丈", "25&1108&153&0&856&55");
		ca_3.put("二宝", "2&1080&285&1");
		ca_3.put("颜如羽", "5&1124&484&1");
	}
	
	static {  
		
		ca_4.put("流浪艺人", "2&905&264&0");
		ca_4.put("袁天罡", "12&905&264&0");
		ca_4.put("小宝","2&776&406&0");
		ca_4.put("大宝", "2&494&604&0");
		ca_4.put("王夫人", "2&907&526&0");
		ca_4.put("张裁缝", "9&907&526&0");
		ca_4.put("饰品店老板", "19&907&526&0");
		ca_4.put("赵姨娘", "24&907&526&0");
		ca_4.put("小怜香", "4&630&550&1");
		ca_4.put("小惜玉", "4&630&550&1");
		ca_4.put("陈妈妈", "6&630&550&0");
		ca_4.put("罗百万", "5&630&550&0");
		ca_4.put("小桃红", "5&630&550&0");
	}
	
    private void goBackHome1(String device, String path) throws Exception {
		// =======================回门派========================
		while (true) {
			// # 加血 加蓝
			ScreenCapture.mouseClick(device, "1400 40");//
			ScreenCapture.mouseClick(device, "1193 109");// # 加血
			ScreenCapture.mouseClick(device, "1400 40");//
			ScreenCapture.mouseClick(device, "1359 109");// # 使用

			ScreenCapture.mouseClick(device, "1211 682");
			ScreenCapture.mouseClick(device, "1242 587");
			ScreenCapture.mouseClick(device, "1211 682");
			ScreenCapture.snapshot(device, path, "screen.png");
			ImageUtils.cutPNG(new FileInputStream(path + "screen.png"), new FileOutputStream(path + device + ".png"),
					93, 18, 117, 35);
			String area = baiduOCR.generalBasic(path + device + ".png");
			log.info("area:" + area);
			if (area.indexOf("凌波城") == -1) {
				
				ScreenCapture.mouseClick(device, "1211 682");
				ScreenCapture.mouseClick(device, "1242 587");
				ScreenCapture.mouseClick(device, "1211 682");
			} else {
				break;
			}

		}
		// =====================回门派=====================
	}
    
	private void goBackHome(String device, String path) throws Exception {
		// =======================回门派========================
		while (true) {
			/*ScreenCapture.snapshot(device, path, "screen.png");
			ImageUtils.cutPNG(new FileInputStream(path + "screen.png"), new FileOutputStream(path + device + ".png"),
					93, 18, 117, 35);
			String area = baiduOCR.generalBasic(path + device + ".png");*/
			ScreenCapture.snapshot(device,path, "screen.png");
	        ImageUtils.cutPNG(new FileInputStream(path +"screen.png"),
	                new FileOutputStream(path + device +".png"), 120,48,63,39);
			ImagePHash p = new ImagePHash();
	        String image1 = p.getHash(new FileInputStream(new File(path + device + ".png")));
	        String image2 = p.getHash(new FileInputStream(new File(SC_PIC_PATH +"is_arrive_sm.png")));
	        int score =  p.distance(image1, image2);
	        log.info(DeviceCodeMapUtil.deviceCode_map.get(device)+"号机器是否在回师门点："+score);
			if (score > 0) {
				ScreenCapture.mouseClick(device, "1400 40");//
				ScreenCapture.mouseClick(device, "1193 109");// # 加血
				ScreenCapture.mouseClick(device, "1400 40");//
				ScreenCapture.mouseClick(device, "1359 109");// # 使用
				
				ScreenCapture.mouseClick(device, "1211 682");
				ScreenCapture.mouseClick(device, "1242 587");
				ScreenCapture.mouseClick(device, "1211 682");
			} else {
				break;
			}

		}
		// =====================回门派=====================
	}

    private String getsmTaskInfo(String device,String path) throws Exception{
    	ScreenCapture.mouseClick(device, "1358 184");
    	Thread.sleep(1 *1000L );
    	ScreenCapture.snapshot(device,path, "screen.png");
    	Thread.sleep(5 * 100L );
        ImageUtils.cutPNG(new FileInputStream(path +"screen.png"),
                new FileOutputStream(path + device +".png"), 506,160,592,35);//y52
        String text =  baiduOCR.generalBasic(path + device +".png");//33 535 1317 620
        ScreenCapture.mouseClick(device, "1138 61");
        return text;
    }
    
    //去掉对话框
    private void moveDialogBox(String device){
    	ScreenCapture.mouseClick(device, "670 589");
    }
    
    private void clickSmTask(String device){
    	ScreenCapture.mouseClick(device, "1430 287");
    }
    
    //去做送信任务
    private void goToTaskForXin(String device,String path,Long sleepTime) throws Exception {
    	clickSmTask(device);
		Thread.sleep(sleepTime);
		log.info("机器到达送信任务点:");
    	ScreenCapture.mouseClick(device, "471 655");
    	//去掉对话框
    	moveDialogBox(device);
    }
    
    
    private boolean doSmTask(String device) throws Exception {
    	String path = SC_PIC_PATH + device +"\\";	
    	String text = getsmTaskInfo(device,path);
    	if (StringUtils.isBlank(text)){
    		log.info(DeviceCodeMapUtil.deviceCode_map.get(device)+"号机器已经没有可以做的师门任务");
    		return true;
    	}
    	log.info(DeviceCodeMapUtil.deviceCode_map.get(device)+"号机器开始师门任务:"+text);
		if (StringUtils.isNotBlank(text) && text.indexOf("任务完成") > -1){
        	//回门派
        	goBackHome1(device,path);//由于完成了任务在门派很远的地方
            //点击师门任务寻ｅ
        	clickSmTask(device);
    		Thread.sleep(6 * 1000L);
    		moveDialogBox(device);
    		clickSmTask(device);
    		moveDialogBox(device);
    		
    		//判断是否完成20次师门任务
    		/*ScreenCapture.snapshot(device,path, "screen.png");
        	Thread.sleep(5 * 100L );
            ImageUtils.cutPNG(new FileInputStream(path +"screen.png"),
                    new FileOutputStream(path + device +".png"), 1120,212,67,30);
            String text_is_finish =  baiduOCR.generalBasic(path + device +".png");
            if(StringUtils.isNotBlank(text_is_finish) && text_is_finish.indexOf("师门") > -1){
            	clickSmTask(device);
        		moveDialogBox(device);
            }else{
            	return true;
            }*/
    		
    		//text = getsmTaskInfo(device,path);

        }
        
        if (StringUtils.isNotBlank(text) && text.indexOf("前往师父") > -1){
        	//回门派
        	goBackHome(device,path);
            //点击师门任务寻ｅ
        	clickSmTask(device);
    		Thread.sleep(6 * 1000L);
    		moveDialogBox(device);
    		//text = getsmTaskInfo(device,path);
        }
        
        //==================================1、送信==================================
        if(StringUtils.isNotBlank(text) && text.indexOf("送信") > -1){
        	//长安1旗子
        	for(String key :ca_1.keySet()){
        		if(text.indexOf(key) > -1 ){
        			String[] infos = ca_1.get(key).split("&");
        			ScreenCapture.mouseClick(device, "1308 675");//  # 打开包裹
            		ScreenCapture.mouseClick(device, "730 224");// 打开ca 1
            		ScreenCapture.mouseClick(device, "522 422");// 使用
            		ScreenCapture.mouseClick(device, infos[1]+" "+infos[2]);
            		ScreenCapture.mouseClick(device, "1156 52");// 关闭包裹
            		//需要走两段路
            		if("1".equals(infos[3])){
            			clickSmTask(device);
                		Thread.sleep(11 * 1000L);
            		}
            		
            		goToTaskForXin(device,path,Integer.valueOf(infos[0]) * 1000L);
            		
            		goBackHome(device, path);
            		clickSmTask(device);
            		Thread.sleep(6 * 1000L);
            		moveDialogBox(device);
            		
            		clickSmTask(device);
            		moveDialogBox(device);
            		break;
        		}
        	}
 
        	//长安2旗子
        	for(String key :ca_2.keySet()){
        		if(text.indexOf(key) > -1 ){
        			String[] infos = ca_2.get(key).split("&");
        			ScreenCapture.mouseClick(device, "1308 675");//  # 打开包裹
            		ScreenCapture.mouseClick(device, "809 212");// 打开ca 2
            		ScreenCapture.mouseClick(device, "522 422");// 使用
            		ScreenCapture.mouseClick(device, infos[1]+" "+infos[2]);
            		ScreenCapture.mouseClick(device, "1156 52");// 关闭包裹
            		goToTaskForXin(device,path,Integer.valueOf(infos[0]) * 1000L);
            		
            		goBackHome(device, path);
            		clickSmTask(device);
            		Thread.sleep(6 * 1000L);
            		moveDialogBox(device);
            		
            		clickSmTask(device);
            		moveDialogBox(device);
            		break;
        		}
        	}
        	
        	//长安3旗子
        	for(String key :ca_3.keySet()){
        		if(text.indexOf(key) > -1 ){
        			String[] infos = ca_3.get(key).split("&");
        			ScreenCapture.mouseClick(device, "1308 675");//  # 打开包裹
            		ScreenCapture.mouseClick(device, "890 212");// 打开ca 3
            		ScreenCapture.mouseClick(device, "522 422");// 使用
            		ScreenCapture.mouseClick(device, infos[1]+" "+infos[2]);
            		ScreenCapture.mouseClick(device, "1156 52");// 关闭包裹
            		// 进入子场景
            		if("0".equals(infos[3])){
            			Thread.sleep(5 * 100L);
            			ScreenCapture.mouseClick(device, infos[4]+" "+infos[5]);
            			Thread.sleep(2 * 1000L);
            		}
            		goToTaskForXin(device,path,Integer.valueOf(infos[0]) * 1000L);
            		
            		goBackHome(device, path);
            		clickSmTask(device);
            		Thread.sleep(6 * 1000L);
            		moveDialogBox(device);
            		
            		clickSmTask(device);
            		moveDialogBox(device);
            		break;
        		}
        	}
   	
        	//长安4旗子
        	for(String key :ca_4.keySet()){
        		if(text.indexOf(key) > -1 ){
        			String[] infos = ca_4.get(key).split("&");
        			ScreenCapture.mouseClick(device, "1308 675");//  # 打开包裹
            		ScreenCapture.mouseClick(device, "986 214");// 打开ca 4
            		ScreenCapture.mouseClick(device, "522 422");// 使用
            		ScreenCapture.mouseClick(device, infos[1]+" "+infos[2]);
            		ScreenCapture.mouseClick(device, "1156 52");// 关闭包裹
            		//需要走两段路
            		if("1".equals(infos[3])){
            			clickSmTask(device);
                		Thread.sleep(11 * 1000L);
            		}
            		goToTaskForXin(device,path,Integer.valueOf(infos[0]) * 1000L);
            		
            		goBackHome(device, path);
            		clickSmTask(device);
            		Thread.sleep(6 * 1000L);
            		moveDialogBox(device);
            		
            		clickSmTask(device);
            		moveDialogBox(device);
            		break;
        		}
        	}
        	

        }
        
    	
    	//==================================1、送信==================================
    	
    	//2、巡逻
        if(StringUtils.isNotBlank(text) && text.indexOf("巡逻") > -1){
        	//回门派
        	goBackHome(device,path);
        	while(true){
        		ScreenCapture.mouseClick(device, "457 608");
            	Thread.sleep(1 * 1000l);
            	ScreenCapture.snapshot(device,path, "screen.png");
                
                ImageUtils.cutPNG(new FileInputStream(path +"screen.png"),
                        new FileOutputStream(path + device + "_zd.png"), 862,635,88,88);
                ImagePHash p = new ImagePHash();
                String image1 = p.getHash(new FileInputStream(new File(path + device + "_zd.png")));
                String image2 = p.getHash(new FileInputStream(new File(SC_PIC_PATH +"zd.png")));
                int score =  p.distance(image1, image2);
                if(score < 10){
        			ScreenCapture.mouseClick(device, "1390 681");// #自动
        			while(true){
        				Thread.sleep(2 * 1000L);
        				ScreenCapture.snapshot(device,path, "screen.png");
        				ImageUtils.cutPNG(new FileInputStream(path +"screen.png"),
        		                new FileOutputStream(path + device + "_zd.png"), 901,660,30,30);
        		        image1 = p.getHash(new FileInputStream(new File(path + device + "_zd.png")));
        		        image2 = p.getHash(new FileInputStream(new File(SC_PIC_PATH +"zd_over_sm.png")));
        		        int score_over =  p.distance(image1, image2);
        		        if(score_over < 10){
        		        	moveDialogBox(device);
        		        	ScreenCapture.mouseClick(device, "1242 558");//  # 取消自动自动
        		        	//text = getsmTaskInfo(device,path);
        		        	score = 999;
        		        	break;
        		        }
        			}
        		}else{
        			ScreenCapture.mouseClick(device, "1189 113");
        			Thread.sleep(3 * 1000l);
        		}
                
                if(score == 999){
                	break;
                }
        	}
        	
    	}
        
    	//3、寻物
        if(StringUtils.isNotBlank(text)  && text.indexOf("送给") > -1){
        	for(String wp:SAVE_TASK_DOODS_ARRAYS){
        		if(text.indexOf(wp) > -1 ){
        			//回门派
                	goBackHome(device,path);
                	clickSmTask(device);
                	Thread.sleep(6 * 1000l);
                	// 确认提交物品
                	ScreenCapture.mouseClick(device, "461 645");
                	moveDialogBox(device);
                	clickSmTask(device);
            		moveDialogBox(device);
                	//text = getsmTaskInfo(device,path);
                	break;
        		}
        	}
        	
        }
        
        if(StringUtils.isNotBlank(text) && text.indexOf("送给") > -1){
        	// 是否获取到物品的标志
        	boolean flag = false;
        	for(String wp_key :wp_arrays.keySet()){
        		if(text.indexOf(wp_key) > -1){
        			String[] wpInfos = wp_arrays.get(wp_key).split("&");
        			//0-武器
                    if("0".equals(wpInfos[0])){
                    	ScreenCapture.mouseClick(device, "1308 675");//  # 打开包裹
                		ScreenCapture.mouseClick(device, "988 219");// 打开ca 1
                		ScreenCapture.mouseClick(device, "522 422");// 使用
                		ScreenCapture.mouseClick(device, "1051 536");//长安武器店门口
                		ScreenCapture.mouseClick(device, "1156 52");// 关闭包裹
                		// 进入店中
                		ScreenCapture.mouseClick(device, "809 237");
                		Thread.sleep(2 * 1000L);
                		// 
                		ScreenCapture.mouseClick(device, "502 329");
                		Thread.sleep(1 * 1000L);
                		ScreenCapture.mouseClick(device, "1218 355");
                		Thread.sleep(1 * 1000L);
                		ScreenCapture.mouseClick(device, wpInfos[1]+" "+wpInfos[2]);
                		Thread.sleep(1 * 1000L);
                		ScreenCapture.mouseClick(device, "1175 655");
                		moveDialogBox(device);
                		// 关闭武器页面
                		ScreenCapture.mouseClick(device, "1387 47");
                		flag = true;
                    }
                    //1-饰品
                    if("1".equals(wpInfos[0])){
                    	ScreenCapture.mouseClick(device, "1308 675");//  # 打开包裹
                		ScreenCapture.mouseClick(device, "894 221");// 打开ca 3
                		ScreenCapture.mouseClick(device, "522 422");// 使用
                		ScreenCapture.mouseClick(device, "907 582");//放大
                		ScreenCapture.mouseClick(device, "913 584");//到饰品店门口
                		ScreenCapture.mouseClick(device, "1156 52");// 关闭包裹
                		// 进入店中
                		ScreenCapture.mouseClick(device, "650 250");
                		Thread.sleep(2 * 1000L);
                		ScreenCapture.mouseClick(device, "661 228");
                		Thread.sleep(4 * 1000L);
                		ScreenCapture.mouseClick(device, "667 254");//点击npc
                		
                		Thread.sleep(1 * 1000L);
                		ScreenCapture.mouseClick(device, "1218 355");//购买
                		Thread.sleep(1 * 1000L);
                		ScreenCapture.mouseClick(device, wpInfos[1]+" "+wpInfos[2]);
                		Thread.sleep(1 * 1000L);
                		ScreenCapture.mouseClick(device, "1175 655");
                		moveDialogBox(device);
                		// 关闭页面
                		ScreenCapture.mouseClick(device, "1387 47");
                		flag = true;
                    }
                    //2-装备
                    if("2".equals(wpInfos[0])){
                    	
                    }
                    //3-杂货
                    if("3".equals(wpInfos[0])){
                    	
                    }
                  //3-香黄纸蜡烛
                    if("4".equals(wpInfos[0])){
                    	ScreenCapture.mouseClick(device, "1308 675");//  # 打开包裹
                		ScreenCapture.mouseClick(device, "890 212");// 打开ca 3
                		ScreenCapture.mouseClick(device, "522 422");// 使用
                		ScreenCapture.mouseClick(device, "1108 153");//化生寺门口
                		ScreenCapture.mouseClick(device, "1156 52");// 关闭包裹
                		// 打开地图
                		ScreenCapture.mouseClick(device, "150 47");
                		ScreenCapture.mouseClick(device, "1124 195");
                		//关闭地图
                		ScreenCapture.mouseClick(device, "1199 52");
                		Thread.sleep(11 * 1000L);
                		ScreenCapture.mouseClick(device, "850 278");
                		Thread.sleep(2 * 1000L);
                		ScreenCapture.mouseClick(device, "734 357");
                		Thread.sleep(3 * 1000L);
                		//点击NPC
                		ScreenCapture.mouseClick(device, "844 240");
                		
                		Thread.sleep(1 * 1000L);
                		ScreenCapture.mouseClick(device, "1218 355");//购买
                		Thread.sleep(1 * 1000L);
                		ScreenCapture.mouseClick(device, wpInfos[1]+" "+wpInfos[2]);
                		Thread.sleep(1 * 1000L);
                		ScreenCapture.mouseClick(device, "1175 655");
                		moveDialogBox(device);
                		// 关闭页面
                		ScreenCapture.mouseClick(device, "1387 47");
                		flag = true;
                    }
                    
        			break;
        		}
        	}
        	//买好物品，开始回家交给师傅
        	if(flag){
        		log.info(DeviceCodeMapUtil.deviceCode_map.get(device)+"号机器师门任务已经买到物品，开始回家交给师傅");
        		goBackHome(device, path);
        		clickSmTask(device);
        		Thread.sleep(6 * 1000L);
        		// 回到道具页面
        		ScreenCapture.mouseClick(device, "726 259");
        		// 点击物品提交，默认包裹第二排一个
        		ScreenCapture.mouseClick(device, "709 435");
        		// 确认
        		ScreenCapture.mouseClick(device, "459 653");
        		moveDialogBox(device);
        		clickSmTask(device);
        		moveDialogBox(device);
        	}else{
        		log.info(DeviceCodeMapUtil.deviceCode_map.get(device)+"号机器师门任务没有买到物品，请查明原因");
        	}
        	
        }
        log.info(DeviceCodeMapUtil.deviceCode_map.get(device)+"号机器完成了师门任务:"+text);
        return false;
	}
}
